/**
 * 
 */
package com.dsteiner.widgets.client.model;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;

import com.dsteiner.widgets.client.PropertyChangeCollection;

public class RateItModel{
	
    private Integer rating;
	private Integer selection;
	private PropertyChangeCollection propertyChangeSupport = new PropertyChangeCollection(
			this);
	
	private String message;

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		String oldMessage = this.message;
		this.message = message;
		propertyChangeSupport.firePropertyChange("message", oldMessage, message);
	}
	public void addPropertyChangeListener(String propertyName,
			PropertyChangeListener listener) {
		propertyChangeSupport.registerPropertyChangeListener(propertyName,
				listener);
	}
	
	public Integer getRating() {
		return rating;
	}

	public Integer getSelection() {
		return selection;
	}
	private Integer clickedRating;

	public Integer getClickedRating() {
		return clickedRating;
	}

	public void setClickedRating(Integer clickedRating) {
		Integer oldClickedRating = this.clickedRating;
		this.clickedRating = clickedRating;
		propertyChangeSupport.firePropertyChange("clickedRating", null, clickedRating);
	}

	public void setRating(Integer rating) {
		Integer oldRating = this.rating;
		this.rating = rating;
		if(oldRating == null && rating == null)
			return;
		propertyChangeSupport.firePropertyChange("rating", oldRating, rating);
	}
	public void setSelection(Integer selection) {
		Integer oldSelection = this.selection;
		this.selection = selection;
		propertyChangeSupport.firePropertyChange("selection", oldSelection, selection);
	}
}